package indi.gao.redis;

import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c)2020$</p>
 * <p>Company: Tope</p>
 * <P>Created Date :2020$-03$-23$</P>
 * <P>@version 1.0</P>
 */
public class RedisString {
    public static void main(String[] args) {

        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxIdle(3);
        config.setTestOnBorrow(true);
        redis.clients.jedis.Jedis jedisClient;
        jedisClient = new JedisPool(config, "127.0.0.1", 6379, 30000, "TopE#6%@2o1^7ll").getResource();

        // 先从缓存中取学生Id
        String primaryKey = "ee_ticket_reward_studentId_list";
        String studentIdsString = jedisClient.get(primaryKey);
        if (studentIdsString == null) {
            studentIdsString = null;
            jedisClient.set(primaryKey, studentIdsString);
        }
        List<Long> studentIdsList = Stream.of(studentIdsString.split(",")).map(Long::parseLong).collect(Collectors.toList());
        boolean contains = studentIdsList.contains(Long.valueOf("156"));
        System.out.println(contains);

        System.out.println(Integer.MAX_VALUE + "+" + Integer.MIN_VALUE);
    }
}
